package com.example.testforbookstore;

import org.json.JSONArray;

import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        System.out.println("Hello");
        List<Book> testBookList = new ArrayList<>();
        testBookList.add(new Book(1,"hh1", "gbg", 20.12, R.drawable.test25, "good"));
        testBookList.add(new Book(2,"hh2", "gbg", 20.12, R.drawable.test26, "good"));
        testBookList.add(new Book(3,"hh3", "gbg", 20.12, R.drawable.test25, "good"));
        testBookList.add(new Book(4,"hh4", "gbg", 20.12, R.drawable.test26, "good"));
        JSONArray jsonArray = new JSONArray(testBookList);
        for (int i = 0; i < jsonArray.length(); i++) {
            System.out.println("hello");
            try {
                System.out.println(jsonArray.get(i).toString());
            }catch (Exception e){
                System.out.println(e.getMessage());
            }

        }

    }
}
